//detect the browser
var browser = BrowserDetect.browser;
//get file tipe (pic or gif)
var type = document.getElementById('type').value;

function scrollalert(type){
	if(browser === 'Chrome'){
		var scrolltop=$('#scrollbox').prop('scrollTop');
	}
	else {
		var scrolltop=$('html').prop('scrollTop');
	}
	var top = document.getElementById('top').value;
	if(scrolltop>=top){
		//fetch new items
		$.post('ajax-pics.php?type='+type, {'request': 1}, function(newitems){
			$('#content').append(newitems);
			document.getElementById('top').value = document.getElementById('top').value*1 + 1700;
		});
	}
}
$(document).ready(function() {
	//check scrollbar possition on scroll
    $(window).scroll(function() {
    	scrollalert(type);
   	})
});